package zonasoft.Utilidades;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;

/**
 *
 * @author equipo9
 */
public class ProcuraduriaInfo {

    public static String[] informacionPersona(String cedula) {
        String[] datos=null;
        try {
            // Construct data
            // Send data
            URL url = new URL("http://altamar17.5gbfree.com/pruebas/post2.php?cedula="+cedula);
            URLConnection conn = url.openConnection();
            conn.setDoOutput(true);
            // Get the response
            BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
            String line;
            String nombre;
            while ((line = rd.readLine()) != null) {
                int inicio=line.indexOf("Señor(a)");
                int fin=line.indexOf("identificado(a)");
                if(line.contains("Señor(a) &nbs"))
                {  nombre=line;
                   nombre=nombre.replace("/", "Ñ");
                    System.out.println(nombre.substring(inicio+16, fin));
                    datos=nombre.substring(inicio+16, fin).split(" ");
                }
            }
            rd.close();
        } catch (Exception e) {
        }
          return datos;

    }
}
